// SCENARIO SCRIPT

// This is the special script for your entire scenario. It contains
// special encounters and code accessable from anywhere in the scenario. it also
// contains the code that initializes important special things in the
// scenario (like shops and names and descriptions of special items).

// You can create your own states, but you should give all of them numbers greater than
// or equal to 10.

beginscenarioscript;

variables;

int target, x, y, i, j, choice, pc;

body;

// This is the state that is called every time the scenario is loaded,
// even when a save file in the scenario is loaded. Some things that should go here:
//    Names and descriptions of special items.
//    Names and effects of custom special abilities.
beginstate LOAD_SCEN_STATE;
	init_special_item(0, "Eagle Warrior Gear", "This is the equipment from the Eagle Warrior you killed not too long ago.");
	init_special_item(1, "Obsidite Skull", "A skull fashioned from the notoriously hard to work with obsidite. If nothing else, it can go on your mantelpiece if you get back.");

	init_quest(0, "Stop the natives", "Foil the natives' plan to attack your outposts.");
	break;

// This is the state that is called only once at the very beginning of 
// the scenario. Some things that should go here:
//    The stuff in shops.
//    Creating horses and boats.
beginstate START_SCEN_STATE;

	reset_dialog();
	add_dialog_str(0, "Please note that the scenario is designed for a singleton with no magic.", 0);
	add_dialog_str(1, "Odd behaviour (or plot inconsistencies) may result if you try to use anything else.", 0);
	add_dialog_choice(0, "OK");
	add_dialog_choice(1, "Actually, can I go back?");
	choice = run_dialog(1);

	if (choice == 2)
	{
		set_flag(200, 0, 1);
		end_scenario(2);
	}

break;

// This state is called every tick wherever the party is in the scenario.
// You can use the set_state
beginstate START_STATE;

break;

// Place your own states below. Give each a number at least 10.
//AREA OF EFFECT FIRE GRENADE
beginstate 10;
target = who_is_custom_item_target();
x = char_loc_x(target);
y = char_loc_y(target);
//go through nearby squares: if they've got a jungle plant on, probably burn it
i = x - 2;
while (i < (x + 3))
{
	j = y - 2;
	while (j < (y + 3))
	{
		if (get_ran(2, 0, 1) || (i == x && j == y))
		{
			if (get_terrain(i, j) >= 425 && get_terrain(i, j) <= 440)
			{
				set_terrain(i, j, 0);
			}
			put_boom_on_space(i, j, 1, 0);
		}
		j = j + 1;
	}
	i = i + 1;
}
run_animation_sound(152);
damage_near_loc(x, y, 30, 2, 1);
//still need to add spreading fire?
break;
